<?php

/**
 * Produit form base class.
 *
 * @method Produit getObject() Returns the current form's model object
 *
 * @package    frigospeed
 * @subpackage form
 * @author     0
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseProduitForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'              => new sfWidgetFormInputHidden(),
      'description'     => new sfWidgetFormInputText(),
      'type'            => new sfWidgetFormInputText(),
      'volume'          => new sfWidgetFormInputText(),
      'dimension'       => new sfWidgetFormInputText(),
      'conservationmax' => new sfWidgetFormInputText(),
      'conservationmin' => new sfWidgetFormInputText(),
      'date'            => new sfWidgetFormDate(),
      'photo'           => new sfWidgetFormInputText(),
      'stock'           => new sfWidgetFormInputText(),
      'utilisateur_id'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Utilisateur'), 'add_empty' => false)),
      'entrepot_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Entrepot'), 'add_empty' => false)),
      'prix_achat'      => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'              => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'description'     => new sfValidatorString(array('max_length' => 255)),
      'type'            => new sfValidatorString(array('max_length' => 255)),
      'volume'          => new sfValidatorNumber(),
      'dimension'       => new sfValidatorString(array('max_length' => 255)),
      'conservationmax' => new sfValidatorInteger(),
      'conservationmin' => new sfValidatorInteger(),
      'date'            => new sfValidatorDate(),
      'photo'           => new sfValidatorString(array('max_length' => 255)),
      'stock'           => new sfValidatorInteger(),
      'utilisateur_id'  => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Utilisateur'))),
      'entrepot_id'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Entrepot'))),
      'prix_achat'      => new sfValidatorNumber(),
    ));

    $this->widgetSchema->setNameFormat('produit[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Produit';
  }

}
